import os, fnmatch

try:
    import xml.etree.cElementTree as ET
except ImportError:
    import xml.etree.ElementTree as ET

CFD = ('/home/ben/Jboss/jboss-eap-6.2/domain/configuration')
ConfFiles = []
for root, dirname, filenames in os.walk(CFD):
    for filename in fnmatch.filter(filenames, 'domain.xml'):
        ConfFiles.append(os.path.join(root, filename))


for conf in ConfFiles:
    xmldoc = ET.ElementTree(file=''+conf)
    confroot = xmldoc.getroot()

    print "Management Information"
    for a in list(confroot.iter('{urn:jboss:domain:1.5}management')):
      for b in a:
	#print b.tag
	for c in b:
	  #print c.tag
	  for d in c:
	    print "Configured Roles:", str(d.attrib).split(':')[1].split('}')[0]
	    for e in d:
	      for f in e:
		print "User Database:", str(f.attrib).split(':')[1].split('}')[0]
